﻿@using Learnive.Models
@model HomeViewModel

@{
    ViewBag.Title = "Dashboard";
}

<div style="width:100%;">
    <div style="float: left; line-height:30px; margin-right: 10px;">
        <Strong>Vordering propedeuse: </Strong>
    </div>
    <input id="hiddenbox" type="hidden" value="@{
        var sp = 0;    
        
            foreach (Cijfer c in Model.Cijfers.Where(w => w.Eindresultaat > 5))
            {
               sp += c.Studiepunten;             
            }
            
            sp = sp + 60;
            @sp
        }" />
    <div id="progressBar" >
        <div class="progress progress-striped">
          <div id="progressbox" class="bar"></div>
        </div>
        
    </div>
    
    <div id="prop" style="display: none;">
    <div style="padding-left: 10px;"> 
            <a href="#myModal" id="pbutton" role="button" class="btn btn-primary" data-toggle="modal" style="color:white; font-weight: bold;">Propedeuse aanvragen</a>
            <div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3 id="myModalLabel">Propedeuse aanvragen</h3>
                </div>
                <div class="modal-body">
                    <p>Hiermee bevestig je dat je propedeuse voor 100% bepaald is.</p>
                </div>
                <div class="modal-footer">
                    <button class="btn" data-dismiss="modal" aria-hidden="true">Annuleer</button>
                    <button class="btn btn-primary" onclick="hidePbutton()" data-dismiss="modal" aria-hidden="true">Vraag aan</button>
                </div>
            </div>
                </div>
        </div>   
</div>

@*<a href="#" style="height: 20px; float:right; width: 50px;"></a>*@

<!-- Button to trigger modal -->
<a href="#myModals" onclick="sethiddenbox()" role="button" data-toggle="modal" style="height: 20px; float:right; width: 50px;"></a>
<!--<a href="#myModals" role="button" data-toggle="modal" style="height: 20px; float:right; width: 50px;"></a>-->
 
<!-- Modal -->
<div id="myModals" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalsLabel" aria-hidden="true">
  <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
    <h3 id="myModalsLabel">Cijfer MVC Herkansing</h3>
  </div>
  <div class="modal-body">
    <p>Het nieuwe cijfer voor de MVC herkansing is toegevoegd. Gefeliciteerd, je hebt een 8 bepaald voor dit vak.</p>
  </div>
  <div class="modal-footer">
      <form>
          <button type="submit" class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
      </form>   
  </div>
</div>


<ul id="homepage-container">
			<li class="homepage-widget con" id="hpw1">
				<div class="homepage-widget-topbar">
					Mededelingenbord
				</div>
				<div class="homepage-widget-content">
					<div id="tableBoard">
                        <div id="slider">
                         <ul>
                         @if(1 == 1){
         
                            int counter = 1;
        
                            foreach (MessageBoard item in Model.MessageBoards) {
                                String sliderid = "slide" + Convert.ToString(counter);
                                    <li id="@sliderid">
                                        <div class="titleBoard">
                                            <strong>@Html.DisplayFor(modelItem => item.messageName)</strong>
                                        </div>
                                        <div class="messageBoard">
                                            @Html.DisplayFor(modelItem => item.Message)
                                        </div>
                                    </li>
                                counter++;
                            }
                        }
                        </ul>
                        <div class="navigatie">
                            <a id="vorige"><img src="../../Content/image/arrow_left.png" alt="arrow" /></a>
                            <a id="volgende"><img src="../../Content/image/arrow_right.png" alt="arrow" /></a>
                        </div>
                    </div>
				</div>
				</div>
			</li>

			<li class="homepage-widget con" id="hpw2">
				<div class="homepage-widget-topbar">
					Webmail
				</div>
				<div class="homepage-widget-content">
                    <table>
                        <tr>
                            <td><strong>Datum</strong></td>
                            <td><strong>Afzender</strong></td>
                            <td><strong>Onderwerp</strong></td>
                        </tr> 
                        @foreach (Webmail w in Model.Webmails.OrderByDescending(w => w.ID))
                        {
                            <tr>
                                <td>@Html.DisplayFor(modelItem => w.Datum)</td>
                                <td>@Html.DisplayFor(modelItem => w.Afzender)</td>
                                <td><a href="/Webmail/Details/@w.ID" rel="tooltip" title="@Html.DisplayFor(modelItem => w.Onderwerp)" data-html="true"  data-placement="bottom" data-trigger="hover" data-content="@Html.DisplayFor(modelItem => w.Bericht)"> @Html.DisplayFor(modelItem => w.Onderwerp) </a></td>

                            </tr>
                        }

                    </table>
					@*<img src="~/Content/image/webmail_widget.png" alt="webmail" />*@
				</div>
			</li>

			<li class="homepage-widget con" id="hpw3">
				<div class="homepage-widget-topbar">
					Vakken deze periode
				</div>
				<div class="homepage-widget-content">
                    <table>
                        <tr>
                            <td><strong>Vakcode</strong></td>
                            <td><strong>Vaknaam</strong></td>
                        </tr> 
                        @foreach (Vakje vak in Model.Vakjes.OrderByDescending(w => w.vakID))
                        {
                            <tr>
                                <td>@Html.ActionLink(vak.vakCode, "Details", "Vakje", new { id=vak.vakID }, null)</td>
                                <td>@Html.ActionLink(vak.vakNaam, "Details", "Vakje", new { id=vak.vakID }, null)</td>
                            </tr>
                        }
                 
                    </table>
				</div>
			</li>

			<li class="homepage-widget con" id="hpw4">
				<div class="homepage-widget-topbar">
					Rooster
				</div>
				<div class="homepage-widget-content">
					<p><iframe src="https://www.google.com/calendar/embed?showTitle=0&amp;showDate=0&amp;showPrint=0&amp;showTabs=0&amp;showCalendars=0&amp;showTz=0&amp;mode=WEEK&amp;height=300&amp;wkst=2&amp;bgcolor=%23FFFFFF&amp;src=n1kmgl5mfjb2ha2fe1pfm5r988%40group.calendar.google.com&amp;color=%232F6309&amp;ctz=Europe%2FAmsterdam" style=" border-width:0 " width="375" height="250"></iframe></p>
				</div>
			</li>

			<li class="homepage-widget con" id="hpw5">
				<div class="homepage-widget-topbar">
					Laatste cijfers
				</div>
				<div class="homepage-widget-content">
                    <table>
                        <tr>
                            <td><strong>Datum</strong></td>
                            <td><strong>Vakcode</strong></td>
                            <td><strong>Eindresultaat</strong></td>
                        </tr>
                        @foreach (Cijfer c in Model.Cijfers.OrderByDescending(q => q.ID))
                        {
                            <tr>
                                <td>@Html.DisplayFor(modelItem => c.Datum)</td>
                                <td>@Html.DisplayFor(modelItem => c.Vak.vakNaam)</td>
                                <td>
                                    <span @if (c.Vak.vakCode == "MT-NLL011I"){ <text>id="tttt"</text>}>@Html.DisplayFor(modelItem => c.Eindresultaat)</span>
                                </td>
                            </tr>
                        }
                    </table>
				    @*<img src="~/Content/image/laatstecijfers.png" alt="cijfers" />*@
				</div>
			</li>

			<li class="homepage-widget con" id="hpw6">
				<div class="homepage-widget-topbar">
					Huiswerk <span><a href="/Huiswerk/Create" style="float:right; line-height:31px;"><i class="icon-plus"></i> Huiswerk toevoegen</a></span>
				</div>
				<div class="homepage-widget-content">
                    <table>
                        <tr>
                            <td><strong>Datum</strong></td>
                            <td><strong>Vakcode</strong></td>
                            <td><strong>Huiswerk</strong></td>
                        </tr>
                        @foreach (Huiswerk hwerk in Model.Huiswerken.OrderByDescending(w => w.huiswerkID))
                        {
                            var detail = hwerk.huiswerkDetail;
                                
                            <tr>
                                <td>@Html.DisplayFor(modelItem => hwerk.huiswerkDatum)</td>
                                <td>@Html.DisplayFor(modelItem => hwerk.Vak.vakCode)</td>
                                <td><a href="#" rel="tooltip" title="@Html.DisplayFor(modelItem => hwerk.huiswerkNaam)" data-html="true" data-trigger="hover" data-placement="bottom" data-content="@Html.Raw(hwerk.huiswerkDetail)"> @Html.DisplayFor(modelItem => hwerk.huiswerkNaam) </a></td>
                            </tr>
                        }
                    </table>
				</div>
			</li>

            <li class="homepage-widget con" id="hpw7">
				<div class="homepage-widget-topbar">
					Leerdoelen <span><a href="/Leerdoel/Create" style="float:right; line-height:31px;"><i class="icon-plus"></i> Leerdoel toevoegen</a></span>
				</div>
				<div class="homepage-widget-content">
                    <table>
                        <tr>
                            <td><strong>Leerdoel</strong></td>
                            <td><strong>Status</strong></td>
                        </tr>
                        @foreach (Leerdoel l in Model.Leerdoelen.OrderByDescending(w => w.ID))
                        {
                            var status = l.status;
                            var sta = status + "%";
                            var c = "progress-success";
                            var def = "progress-warning";
                            var d = "progress-danger";
                            <tr>
                                <td>@Html.DisplayFor(modelItem => l.Naam)</td>
                                <td>
                                    <div id="progressBar2">
                                        <div class="progress @{
                                         if(status == 100){ @c}
                                         else if (status < 33) { @d }
                                         else{ @def }
                                                                
                                        } progress-striped">
                                          <div class="bar" style="width: @sta;"> @sta</div>
                                        </div>
        
                                    </div>
                                </td>
                                <td><a href="/Leerdoel/edit/@l.ID" style="float:right; line-height:31px;"><i class="icon-edit"></i></a></td>
                            </tr>
                        }
                    </table>
				</div>
			</li>
		</ul>